package com.tudouji.project.pay.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.pay.domain.Payorderlist;
import com.tudouji.project.pay.service.IPayorderlistService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 支付明细Controller
 * 
 * @author tudouji
 * @date 2021-04-09
 */
@RestController
@RequestMapping("/pay/payorderlist")
public class PayorderlistController extends BaseController
{
    @Autowired
    private IPayorderlistService payorderlistService;

    /**
     * 查询支付明细列表
     */
    @PreAuthorize("@ss.hasPermi('pay:payorderlist:list')")
    @GetMapping("/list")
    public TableDataInfo list(Payorderlist payorderlist)
    {
        startPage();
        List<Payorderlist> list = payorderlistService.selectPayorderlistList(payorderlist);
        return getDataTable(list);
    }

    /**
     * 导出支付明细列表
     */
    @PreAuthorize("@ss.hasPermi('pay:payorderlist:export')")
    @Log(title = "支付明细", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Payorderlist payorderlist)
    {
        List<Payorderlist> list = payorderlistService.selectPayorderlistList(payorderlist);
        ExcelUtil<Payorderlist> util = new ExcelUtil<Payorderlist>(Payorderlist.class);
        return util.exportExcel(list, "payorderlist");
    }

    /**
     * 获取支付明细详细信息
     */
    @PreAuthorize("@ss.hasPermi('pay:payorderlist:query')")
    @GetMapping(value = "/{guid}")
    public AjaxResult getInfo(@PathVariable("guid") String guid)
    {
        return AjaxResult.success(payorderlistService.selectPayorderlistById(guid));
    }

    /**
     * 新增支付明细
     */
    @PreAuthorize("@ss.hasPermi('pay:payorderlist:add')")
    @Log(title = "支付明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Payorderlist payorderlist)
    {
        return toAjax(payorderlistService.insertPayorderlist(payorderlist));
    }

    /**
     * 修改支付明细
     */
    @PreAuthorize("@ss.hasPermi('pay:payorderlist:edit')")
    @Log(title = "支付明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Payorderlist payorderlist)
    {
        return toAjax(payorderlistService.updatePayorderlist(payorderlist));
    }

    /**
     * 删除支付明细
     */
    @PreAuthorize("@ss.hasPermi('pay:payorderlist:remove')")
    @Log(title = "支付明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{guids}")
    public AjaxResult remove(@PathVariable String[] guids)
    {
        return toAjax(payorderlistService.deletePayorderlistByIds(guids));
    }
}
